﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using System.IO;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace _3D_FileExplorer
{
    public class Parameters
    {
        public bool keyBoardControl = true;

        //CreateGraphics tree
        public float radiusDifference = 0.4f;
        public float emptyBranchOverlap = 2f;
        public float firstObjectOffset = 3f;
        public float spaceBetweenObjects = 2f;
        public bool enableCameraDollyIn = true;
        //Camera
        public float cameraSpeed = 2f;

        //DrawGraphics tree
        public string defaultPath = "%userprofile%";
        public int defaultBranchLevel = 3;
        public Color diffuseColor = Color.White;

        //CameraAnimation
        public float DollyInSpeed = 0.01f;

        //Other
        public bool ContentRating = true;
        public int maxFiles = 1000;
        public int maxDirs = 1000;
        public int cylinderFaces = 20;
        

        public Parameters()
        {
        }

        public static void SerializeToXML(Parameters par)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(Parameters));
            TextWriter textWriter = new StreamWriter(Environment.CurrentDirectory + @"/XMLfiles/parameters.xml");
            serializer.Serialize(textWriter, par);
            textWriter.Close();
            
        }
        public static Parameters DeserializeFromXML()
        {
            XmlSerializer deserializer = new XmlSerializer(typeof(Parameters));
            TextReader textReader = new StreamReader(Environment.CurrentDirectory + @"/XMLfiles/parameters.xml");
            Parameters par;
            par = (Parameters)deserializer.Deserialize(textReader);
            textReader.Close();

            return par;
        }
    }
}
